﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace Core.LockStep
{
    [AttributeUsage(AttributeTargets.Class)]
    public class LockstepInfoAttribute : Attribute
    {

    }

    public class LockstepInfoData : StreamData<LockstepInfoData>
    {
        // 自己操作的玩家ID，发送消息时需要标记消息源
        public int playerId;
        // 版本(预留)，将用于区分不同版本的回放记录
        public int version = 1;

        public override LockstepInfoData ReadFrom(IFrameDataStream stream)
        {
            playerId = stream.ReadInt32();
            version = stream.ReadInt32();
            return this;
        }

        public override void WriteTo(IFrameDataStream stream)
        {
            stream.WriteInt32(playerId);
            stream.WriteInt32(version);
        }

        public override void Clear()
        {
            playerId = 0;
        }
    }
}